package com.company;

import java.util.Random;
import java.util.Scanner;

/**
 * Created by xujc on 7/15/15.
 */
public class T {
    public static void main(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                System.out.print(i + "*" + j+"="+j*i + "\t");
            }
            System.out.println();
        }
        initdata();
        Scanner scanner=new Scanner(System.in);
        while (true){
            System.out.print("input page number: ");
            int i = scanner.nextInt();
            print(i);
        }
    }

    public static int[] data=new int[73];
    public static void initdata(){
        Random random=new Random(342);
        for (int i = 0; i < data.length; i++) {
            data[i]=random.nextInt(10000);
        }
    }

    public static void print(int page){
        if (page>(int)Math.ceil(((double)data.length)/20)){
            System.out.println("out of index");
        }
        System.out.println("page:"+page);
        System.out.println("page count:"+(int)Math.ceil(((double)data.length)/20));
        System.out.println("record:" + (20 * (page - 1) + 1) + " - " + ((20*(page))<data.length?(20*page):data.length));
        for (int i = (page-1) * 20; i < page*20 && i<data.length; i++) {
            System.out.println(data[i]);
        }
    }
}
